<template>
	<BasicModal v-bind="$attrs" z-index="1000" style="z-index:999" @register="registerModal" title="添加日程"
		@ok="confirmSelect" :helpMessage="['提示1', '提示2']">
		<BasicForm @register="registerForm" style="    height: 320px;"/>

	</BasicModal>
</template>
<script lang="ts" setup>
	import { formSchema } from './tableData';
	import { DatePicker } from 'ant-design-vue';
	import AMapLoader from '@amap/amap-jsapi-loader';
	import {BasicForm, useForm} from '/@/components/Form/index';
	import { defineComponent, ref,unref,computed} from 'vue';
	import { useMessage } from '/@/hooks/web/useMessage';
	import { BasicModal, useModalInner } from '/@/components/Modal';
	import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
	let marker = null;
	const emit = defineEmits(['register','successConfirm']);
	const { createMessage } = useMessage();
	const isUpdate = ref(true);
	async function confirmSelect() {
		 let values = await validate();
		
		emit('successConfirm', values,isUpdate.value);
		closeModal()
	}
	const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
		setModalProps({ zIndex: 1000 })
		//重置表单
		 await resetFields();
		 setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
		 isUpdate.value = !!data?.isUpdate;
		 if (unref(isUpdate)) {
		     //表单赋值
		     await setFieldsValue({
		         ...data.record,
		     });
		 }
		 // 隐藏底部时禁用整个表单
		setProps({ disabled: !data?.showFooter })
	})
	//表单配置
	const [registerForm, { setProps, resetFields, setFieldsValue, validate }] = useForm({
		//labelWidth: 150,
		schemas: formSchema,
		showActionButtonGroup: false,
		baseColProps: { span: 24 }
	});
</script>

<style>
	
	.ant-modal-content{
		width:1000px !important;
		margin-left:-200px;
	}
	#pickerBox {
		position: absolute;
		z-index: 9999;
		top: 50px;
		right: 30px;
		width: 300px;
	}

	#pickerInput {
		width: 200px;
		padding: 5px 5px;
	}

	#poiInfo {
		background: #fff;
	}

	.amap_lib_placeSearch .poibox.highlight {
		background-color: #CAE1FF;
	}

	.amap_lib_placeSearch .poi-more {
		display: none !important;
	}

	#container {
		padding: 0px;
		margin: 0px;
		width: 100%;
		height: 600px;
	}

	.info {
		padding: .5rem .75rem;
		margin-bottom: 1rem;
		border-radius: .25rem;
		position: fixed;
		top: 15rem;
		background-color: white;
		width: auto;
		z-index: 100;
		min-width: 20%;
		border-width: 0;
		right: 40%;
		box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
	}

	.input-item {
		position: relative;
		display: -ms-flexbox;
		display: flex;
		-ms-flex-wrap: wrap;
		flex-wrap: wrap;
		-ms-flex-align: center;
		align-items: center;
		width: 100%;
		height: 3rem;
	}

	.input-item-prepend {
		margin-right: -1px;
	}

	.input-item-text {
		text-align: justify;
		padding: 0.4rem 0.7rem;
		display: inline-block;
		text-justify: distribute-all-lines;
		text-align-last: justify;
		-moz-text-align-last: justify;
		-webkit-text-align-last: justify;
		-ms-flex-align: center;
		align-items: center;
		margin-bottom: 0;
		font-size: 1rem;
		font-weight: 400;
		line-height: 1.5;
		color: #495057;
		text-align: center;
		white-space: nowrap;
		background-color: #e9ecef;
		border: 1px solid #ced4da;
		border-radius: 0.25rem;
		border-bottom-right-radius: 0;
		border-top-right-radius: 0;
	}

	.input-item-text,
	input[type=text],
	input[type=date],
	select {
		height: calc(2.2rem + 2px);
	}
</style>